#lang racket


(require "../base/main.rkt")

(require "domain.rkt"
         "curve.rkt")

(provide (struct-out circle-curve)
         circle-curve-object
         circle-curve-tangent
         circle-curve-normal
         circle-curve-binormal
         make-circle-curve)


(define-struct (circle-curve curve)
  (radius)
  #:constructor-name new-circle-curve)

(define (circle-curve-object radius)
  (λ (t)
    (sph radius t pi/2)))

(define (circle-curve-tangent radius)
  (λ (t)
    (xyz (- (sin t)) (cos t) 0)))

(define (circle-curve-normal radius)
  (λ (t)
    (xyz (- (cos t)) (- (sin t)) 0)))

(define (circle-curve-binormal radius)
  (λ (t)
    (xyz 0 0 1)))

(define (make-circle-curve radius)
  (new-circle-curve
   (circle-curve-object radius)
   (circle-curve-tangent radius)
   (circle-curve-normal radius)
   (circle-curve-binormal radius)
   (make-t-domain 'closed 0 'open 2pi)
   radius))